feat(migration): add legacy wallet migration package and SDK support#348
Conversation
- persist recurring ZHTLC sync policy while keeping one-shot sync overrides transient during activation - harden KDF start/stop readiness checks and auth retries to recover from stale RPC sockets during wallet flows
…mpat dargon2_flutter's web plugin uses JS interop APIs incompatible with Flutter WASM builds. Replaced with pointycastle's pure-Dart Argon2 implementation which works on all platforms. Removes 7 transitive dargon2 packages from the dependency tree.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49b4c15561
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| final version = await _kdfFramework.version().timeout( | ||
| KdfAuthService._kdfRpcProbeTimeout, | ||
| onTimeout: () => null, | ||
| ); |
There was a problem hiding this comment.
Retry readiness probe when version check throws
When startup is in a transitional state, kdfMainStatus() can report rpcIsUp before the RPC listener is actually reachable, so version() may still throw a transport error. This method currently lets that exception escape, which aborts sign-in/register startup immediately instead of continuing to poll until the timeout window. Catch transient probe errors here and continue the loop (like the timeout path) to avoid intermittent auth failures during KDF warm-up.
Useful? React with 👍 / 👎.
| Future<LegacyWalletSecrets> readWalletSecrets({ | ||
| required LegacyWalletRecord wallet, | ||
| required String password, | ||
| }) async { | ||
| try { |
There was a problem hiding this comment.
Guard secret reads on unsupported platforms
readWalletSecrets skips the platform gate used by listLegacyWallets/deleteLegacyWalletData and immediately attempts legacy storage access. On unsupported runtimes (web/desktop), this can surface adapter/plugin failures as storageAccessError instead of the dedicated unsupported-platform outcome, making caller handling inconsistent and harder to recover from. Add an early isSupportedPlatform check in this entrypoint as well.
Useful? React with 👍 / 👎.
|
Visit the preview URL for this PR (updated for commit af9c5b7): https://komodo-playground--pr348-feat-legacy-wallet-m-e8aljoec.web.app (expires Mon, 20 Apr 2026 09:37:17 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 2bfedd77fdea45b25ba7c784416e81f177aa5c47 |
Catch transient transport errors (SocketException, HttpException, HandshakeException) during the version probe in _waitUntilKdfRpcReady so the polling loop continues instead of aborting the auth flow when kdfMainStatus reports rpcIsUp before the listener is fully reachable. Add isSupportedPlatform guard to readWalletSecrets, consistent with listLegacyWallets and deleteLegacyWalletData, so unsupported runtimes get the dedicated unsupportedPlatform exception instead of a generic storageAccessError.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af9c5b7140
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| final version = await _kdfFramework.version().timeout( | ||
| KdfAuthService._kdfRpcProbeTimeout, | ||
| onTimeout: () => null, | ||
| ); |
There was a problem hiding this comment.
Catch timeout probe failures in RPC readiness loop
The readiness loop can still abort prematurely during normal KDF warm-up because _kdfFramework.version() now has its own 2s timeout and may throw TimeoutException, but this method only retries on socket/HTTP/handshake errors. In that case, _waitUntilKdfRpcReady exits immediately instead of continuing to poll until the overall readiness timeout, which can cause intermittent startup/sign-in/register failures on slower devices or cold starts.
Useful? React with 👍 / 👎.
Status
READY
Description
Adds end-to-end support for migrating legacy native-app wallets into KDF-managed wallets.
New package:
komodo_legacy_wallet_migrationpointycastle(WASM-compatible, replacesdargon2_flutter)LegacyWalletRecord,LegacyWalletSecrets,LegacyWalletCleanupResult, and migration exceptionskomodo_defi_sdkZhtlcRecurringSyncPolicytype and persistence — separates persisted recurring sync preferences from one-shot sync overrides so reactivations use the correct policy without accidental rewindsActivationConfigServicegains recurring-policy CRUD, one-shot consume/take semantics, and migration-aware config promotionsync_paramson subsequent activationsActivationConfigServiceandZhtlcActivationStrategyone-shot behaviorkomodo_defi_frameworkresetHttpClient()after stop to drop stale keep-alive socketsisRunning()gainsallowVersionFallbackparameter to avoid HTTP probes during shutdown verificationkomodo_defi_local_authKdfUserdirectly instead of requiring a post-register read_waitUntilKdfRpcReady()replaces_waitUntilKdfRpcIsUp()with stricter two-phase readiness (status + version probe) and configurable timeouts_runStartupSensitiveRpc()retry wrapper that resets the HTTP client and re-waits for RPC readiness on transport failureskomodo_defi_typesAuthExceptionType.legacyWalletAlreadyMigratedvariant and convenience constructorkomodo_defi_rpc_methodssync_paramsdoc comments to clarify client-optional / backend-resume semanticsType of Change